<?php

namespace app\api\controller\user;

use app\api\service\user\UserDynamicsService;
use hunma\basic\ApiResponse;
use hunma\basic\BaseController;

class UserDynamicsController extends BaseController
{
    protected $service;

    /**
     * 构造函数，初始化服务对象
     */
    public function __construct()
    {
        $this->service = new UserDynamicsService();
    }

    public function dynamic()
    {
        return ApiResponse::success($this->service->dynamic());

    }

    public function dynamicSend()
    {

    }

    public function list()
    {
        return ApiResponse::success($this->service->list(self::getAllParams()));
    }

    public function edit()
    {
        $rules = [
            ['id', 'require', '动态ID不能为空'],
            ['content', 'require', '内容不能为空'],
        ];
        $this->parseValidationRules($rules);
        $params = self::getAllParams();
        return ApiResponse::success($this->service->edit($params));
    }

    public function audit()
    {
        $rules = [
            ['ids', 'require', '动态ID不能为空'],
            ['status', 'require', '审核状态不能为空'],
        ];
        $this->parseValidationRules($rules);
        $params = self::getAllParams();
        return ApiResponse::success($this->service->audit($params));
    }
}